import { Component, OnInit } from '@angular/core';
import { Carousel } from '../../model/carousel';
import { CarouselService } from '../../service/carousel.service';

@Component({
  selector: 'app-forshow',
  templateUrl: './forshow.component.html',
  styleUrls: ['./forshow.component.css']
})
export class ForshowComponent implements OnInit {
  cl:Array<Carousel>

  images:Array<string>;
  constructor(private carouselservice:CarouselService) {
    this.cl=new Array();
    // this.cl=new Array();
    // for(let i=0;i<3;i++){
    //   let c=new Carousel();
    //   c.carouselid="id"+i;
    //   c.content="content"+i;
    //   c.title="title"+i;
    //   c.discription="discription"+i;
    //   c.pic="../assets/img/1.jpg";

    //   this.cl.push(c);
    // }
   }

  ngOnInit() {
    //this.images = [1, 2, 3].map(() => `https://picsum.photos/900/500?random&t=${Math.random()}`);
    // this.images=new Array();
    // this.images.push('../assets/img/1.jpg')
    // this.images.push('../assets/img/4.jpg')
    // this.images.push('../assets/img/5.jpg')

    this.carouselservice.getCarouselList()
    .then((data:any)=>{
      this.cl=data;
      console.log(this.cl[0].pic);
    })

  }

}
